<?php 
require dirname(__FILE__).'/includes/common.inc.php';
$head['title'] = $SETTING['sitename'].'_'.$SETTING['meta_title'];
$head['keywords'] = $SETTING['meta_keywords'];
$head['description'] = $SETTING['meta_description'];
header('Last-Modified: '.gmdate('D, d M Y H:i:s', TIME).' GMT');
header('Expires: '.gmdate('D, d M Y H:i:s', TIME+CACHE_PAGE_INDEX_TTL).' GMT');
header('Cache-Control: max-age='.CACHE_PAGE_INDEX_TTL.', must-revalidate');
session_start();

// 绑定二级域名
if($_SERVER['HTTP_HOST'] == 'blog.example.com'){
	$module = 'blog';
} 




if(strpos( strtolower($_SERVER['HTTP_USER_AGENT']), 'android' /*HTTP_USER_AGENT中包含android一定是移动设备*/) !== false){
 	$module = 'webapp';
 }

else{
	
	if(stristr($_SERVER['HTTP_VIA'],'wap')){
		include MOD_ROOT.'webapp/webapp.inc.php';
		exit();	
	}
} 


// 查看伪静态实际url地址情况
	//dump($_SERVER);
	
	if($module){
		$file = $file ? $file : $module;
		$file_path = WWW_ROOT."modules/$module/".$file.".inc.php";
		
		// 系统模块目录
		if(file_exists($file_path)){
			include($file_path);
		}
		else{
			// 自定义模块目录 
			$site_module_file_path = WWW_ROOT."sites/modules/$module/".$file.".inc.php";
			if(file_exists($site_module_file_path)){
				include($site_module_file_path);
			}
			else{
				showmessage("{$site_module_file_path}文件不存在");
			}
		}
	}
	else{
		header("Location: home.php");
	}
	
// 
/*if($_SERVER['QUERY_STRING']){
	
	$a = explode('',$_SERVER['QUERY_STRING']);
	$a = explode('/',$_SERVER['QUERY_STRING']);
	
	for($i=0;$i<count($a);$i++){
		if(!$tpl){
			$tpl .= $a[$i];
		}
		else{
			$tpl .= '_'.$a[$i];
		}
	}
	
	//include('includes/global.func.php');
	include("sites/caches/category/$tpl.php");
	exit();
}
*/




// ?action-list-catid-1 路径可行方案
// 137992916@qq.com

//$querys  = explode('-',$_SERVER['QUERY_STRING']);

//if(count($querys))

//for($i=0;$i<=count($querys);$i=$i+2){
	//$$querys[$i] = $querys[$i+1];
//} 


/* 
邮件测试 
*/
/*include_once('sendmail.class.php');
$sendmail = new sendmail();
echo $sendmail->send('137992916@qq.com', '标题：测试', '内容：邮件发送测试！', '137992916@qq.com') ? '邮件发送成功！' : $sendmail->error[0][1];*/

?>